/*
 * TimelineView.java
 *
 * Created on July 8, 2008, 8:51 PM
 */

package anivis.ui.timeline;

import anivis.base.TimeInterval;
import anivis.layers.Layer;
/**
 *
 * @author  urp
 */
public class TimelineView extends javax.swing.JPanel {

    private IntervalSlider          slider;
    private anivis.ui.Controller    controller;
    private TimeLabelPanel          timeLabels;
    
    /** Creates new form TimelineView */
    public TimelineView(anivis.ui.Controller anivisController) {
      initComponents();
      controller = anivisController;
    }
    
    public TimeInterval getTimeSpan() {
      return timeLabels.getTimeSpan();
    }
    
    
    
    public void addLayer(Layer layer)
    {
      //LayerView           lv = new LayerView(layer);
      //controller.addObserver(lv);
    }
    
    public void setTimeSpan(TimeInterval interval) {
     timeLabels.setTimeSpan(interval);
    }
    
    public TimeInterval getTimeWindow() {
      return slider.getTimeWindow(); 
    }
   
    public void setTimeWindow(TimeInterval interval) {
      slider.setTimeWindow(interval);
    }
           
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jSplitPane1 = new javax.swing.JSplitPane();
    jLayeredPane1 = new javax.swing.JLayeredPane();
    timeLabelPanel1 = new anivis.ui.timeline.TimeLabelPanel();
    jPanel1 = new javax.swing.JPanel();

    setName("Form"); // NOI18N

    jSplitPane1.setDividerLocation(500);
    jSplitPane1.setName("jSplitPane1"); // NOI18N

    jLayeredPane1.setName("LayerPane"); // NOI18N

    timeLabelPanel1.setName("timeLabelPanel1"); // NOI18N
    timeLabelPanel1.setLayout(new java.awt.FlowLayout());
    timeLabelPanel1.setBounds(0, 0, 420, 70);
    jLayeredPane1.add(timeLabelPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jSplitPane1.setLeftComponent(jLayeredPane1);

    jPanel1.setName("jPanel1"); // NOI18N

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(0, 315, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(0, 282, Short.MAX_VALUE)
    );

    jSplitPane1.setRightComponent(jPanel1);

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(layout.createSequentialGroup()
        .addContainerGap()
        .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 826, Short.MAX_VALUE)
        .addContainerGap())
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(layout.createSequentialGroup()
        .addContainerGap()
        .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
        .addContainerGap())
    );
  }// </editor-fold>//GEN-END:initComponents


  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JLayeredPane jLayeredPane1;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JSplitPane jSplitPane1;
  private anivis.ui.timeline.TimeLabelPanel timeLabelPanel1;
  // End of variables declaration//GEN-END:variables

}
